using System;
using System.Collections.Generic;
using System.Data;
using Catastrophe.AutoSulution.EDC;
using Catastrophe.BasePC.UI.File;
using Catastrophe.Common;
using Catastrophe.Common.AttributeEx;
using Catastrophe.Common.FileM;
using Catastrophe.Common.ObjM;
using Catastrophe.CommonCore.FileM;
using Catastrophe.Initialize;
using Catastrophe.Log;
using SqlSugarEx.Config;

namespace Catastrophe.BasePC.UI.SystemIni
{
    public class FileConfigIni : IFileIni, IRunManager
    {
        

        public bool IsRun { get; set; } = true;


        /// <summary>
        /// 系统配置
        /// </summary>
        public static FileConfigEntity? GetFileConfig {  get; set; }

        public void FileRefresh()
        {
        
        }

        public void FileLoad()
        {
            FileRefresh();
        }
        [SystemIni(SystemIniTypeEnum.FileConfig, false)]
        public void LoadAppConfig()
        {
            try
            {
                //框架样式
                var config = new FileConfigManager<FileConfigEntity>(FileTypeEnum.Json).ReadEntity();
                GetFileConfig = config;
            }
            catch (Exception ex)
            {
                LogSession.Ifile.WriteLogNormal(LogLevelEnum.Error, "初始化系统参数失败！", ex, "", nameof(FileRefresh), "Catastrophe.BasePC.UI\\SystemIni\\FileConfigIni.cs", 49);
                throw new Exception("初始化系统参数失败", ex);
            }
        }
    }
}
